
/**
 * @author LKQ
 * @date 2021/11/26 18:42
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        int[] nums = {1,2,3}; int k = 4;
        rotate_1(nums, k);
    }

    public static void rotate_1(int[] nums, int k) {
        int n = nums.length;
        int[] newArr = new int[n];
        for (int i = 0; i < n; ++i) {
            newArr[(i + k) % n] = nums[i];
        }
        System.arraycopy(newArr, 0, nums, 0, n);
    }

}
